<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <style>
    #content {
        width: 200px;
        height: 600px;
        background-color: aquamarine;
        border: 1px solid red;
    }
    </style>
    <title>The 3rd method to create a element.</title>
</head>
<body>
    <input type="button" value="Click" id="btn">
    <div id="content">
        
    </div>

    <script>
    // Bind a function to clicking.
    document.getElementById("btn").onclick = function(){
        var pObj = document.createElement("p");
        pObj.innerText = "I'm a p element.";
        document.getElementById("content").appendChild(pObj);
    }
    
    </script>
</body>
</html>